﻿using BlogApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BlogApi.Services
{
    /// <summary>
    /// 文章TAG仓储接口
    /// </summary>
    public interface IArticleTagRepository
    {
        /// <summary>
        /// 获取文章TAG表的所有数据
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<ArticleTag>> GetArticleTagsAsync();
        /// <summary>
        /// 获取分页后的文章TAG数据
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<ArticleTag>> GetArticleTagsByPageAsync(int pageSize, int pageIndex);
        /// <summary>
        /// 根据用户ID查询分页后的TAG数据
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        Task<IEnumerable<ArticleTag>> GetUserArticleTagsByPageAsync(Guid userId, int pageSize, int pageIndex);
        /// <summary>
        /// 根据文章TAGID获取对应的TAG实体
        /// </summary>
        /// <param name="articleTagId"></param>
        /// <returns></returns>
        Task<ArticleTag> GetArticleTagAsync(Guid articleTagId);
        /// <summary>
        /// 新增一个文章TAG
        /// </summary>
        /// <param name="articleTag"></param>
        void AddArticleTag(ArticleTag articleTag);
        /// <summary>
        /// 更新文章TAG
        /// </summary>
        /// <param name="articleTag"></param>
        void UpdateArticleTag(ArticleTag articleTag);
        /// <summary>
        /// 删除一个TAG
        /// </summary>
        /// <param name="articleTag"></param>
        void DeleteArticleTag(ArticleTag articleTag);
        /// <summary>
        /// 判断TAG是否存在
        /// </summary>
        /// <param name="articleTagId"></param>
        /// <returns></returns>
        Task<bool> ArticleTagExistsAsync(Guid articleTagId);
        /// <summary>
        /// 判断用户的文章TAG是否已经存在
        /// </summary>
        /// <param name="articleTagName"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<bool> UserArticleTagNameExistsAsync(string articleTagName, Guid userId);
        /// <summary>
        /// 把更改的内容更新到数据库
        /// </summary>
        /// <returns></returns>
        Task<bool> SaveAsync();
    }
}
